package com.itheima.d9_tcp6.ZengTest;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.*;

/**
 * @ClassName server
 * @Author 16799
 * @Date 2025/9/27 12:26
 * @Version 1.0
 * @Description TODO
 **/
public class server {
    public static void main(String[] args) throws Exception {
        System.out.println("--------------服务端启动成功---------------");
        ServerSocket serverSocket = new ServerSocket(8877);

        ThreadPoolExecutor pool = new ThreadPoolExecutor(3,5,0, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(5), Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());

        while (true){
            Socket socket = serverSocket.accept();

            pool.execute(new serverThread(socket));
        }
    }
}
